import { IncomingHttpHeaders } from 'http';
import query from '@dfeidao/atom-nodejs/db/query';
import { systemid, productid } from '../../atom/config';

interface Message {
	_id: string[]
}

// interface IWebResult {
// 	data: unknown;
// 	cookie?: {
// 		[name: string]: string;
// 	} | null;
// 	content_type?: string;
// 	headers?: {
// 		[key: string]: string;
// 	};
// 	attachment?: string;
// 	redirect?: string;
// 	status_code?: number;
// }

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const { prepare, exec } = query(action_id, session_id, systemid);
	prepare('hazard_source', ['hidden_source', 'hidden_name', 'hidden_code', 'control_level', 'engineer_skill', 'duty_department', 'responsible'], { productid }, 5, 1, [], []);
	const [data] = await exec();
	return {
		data: {
			data
		}
	}
}
